//
//  BaseTitleView.m
//  fintech_prod
//
//  Created by 小崔 on 2020/2/7.
//  Copyright © 2020 小崔. All rights reserved.
//

#import "BaseTitleView.h"

@implementation BaseTitleView

- (instancetype)init
{
    self = [super init];
    if (self) {
        self.backgroundColor = Rgb2UIColor(187, 2, 9, 1);
        [self addSubview:self.returnBtn];
        [self addSubview:self.titleLab];
        WEAKSELF
        [self.returnBtn mas_makeConstraints:^(MASConstraintMaker *make) {
                  make.left.equalTo(weakSelf.mas_left).offset(10);
            make.centerY.equalTo(self.titleLab.mas_centerY);
                  make.width.equalTo(@44);
                  make.height.equalTo(@44);
              }];
        CGFloat topOffset = kSafeTopHeight;
        if (topOffset) {
            topOffset += 20;
        }else{
            topOffset +=25;
        }
        [self.titleLab mas_makeConstraints:^(MASConstraintMaker *make) {
                  make.left.equalTo(weakSelf.mas_left).offset(30);
                  make.right.equalTo(weakSelf.mas_right).offset(-30);
                  make.top.equalTo(weakSelf.mas_top).offset(topOffset);
                  make.height.equalTo(@23);
                  make.bottom.equalTo(weakSelf.mas_bottom).offset(-14);
        }];
        
    }
    return self;
}
-(UIButton *)returnBtn{
    if (!_returnBtn) {
        self.returnBtn = [UIButton buttonWithType:UIButtonTypeCustom];
        [_returnBtn setImage:[UIImage imageNamed:@"Login_Return"] forState:UIControlStateNormal];
    }
    return _returnBtn;
}
-(UILabel *)titleLab{
    if (!_titleLab) {
        self.titleLab = [[UILabel alloc]init];
        _titleLab.text = @"";
        _titleLab.font = SYSTEMFONT(18);
        _titleLab.textAlignment = NSTextAlignmentCenter;
        _titleLab.textColor = [UIColor whiteColor];
    }
    return _titleLab;
}

@end
